﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;

namespace DirectPOS.Printer.Bixolon {

  // Bixolon units are actually the same as Samsung, ie same hardware but marketted and sold by both.
  // The command sets were developed from Epson command sets.
  // So most of this works wtih Epson, Samung, and other Bixolon models.
  // However I only use the SRP-350plus, so for now all code is in this class. 
  // If others contribute, common stuff will need to be moved into common ancestor classes.

  public class Srp350Plus : Base {

    public Srp350Plus(string aPrinterName) {
      mPrinterName = aPrinterName;
      mPreCutFeedUnits = 20;
    }

    public override void OpenCashDrawer() {
      RawPrinter.Send(mPrinterName, new byte[] {ESC, 0x70, 0x00, 0x19, 0xFF});
    }

    public override void FlushPage() {
      WriteBytesToBuffer(new byte[] { ESC, FF });
    }

    public override void CutPaper(byte aFeedUnits) {
      FlushPage();
      // +[n * vertical motion unit]
      // 0.125 mm {1/203 inches}
      WriteBytesToBuffer(new byte[] { GS, 0x56, 65, 20 });
    }

  }
}
